import { Button, Popconfirm, Space } from 'antd'

export const getColumns = (
    handleDelete: (key: React.Key) => void,
    handleEdit: (record: any) => void,
    handleDetail: (record: any) => void
) => [
    {
        title: '序号',
        dataIndex: 'index',
        key: '1',
    },
    {
        title: '申报单编号',
        dataIndex: 'No',
        key: '2',
    },
    {
        title: '申报大区',
        dataIndex: 'origin',
        key: '3',
    },
    {
        title: '经销商',
        dataIndex: 'dealer',
        key: '4',
    },
    {
        title: 'SKU种类',
        dataIndex: 'skuType',
        key: '5',
    },
    {
        title: '申报总数',
        dataIndex: 'totalDeclared',
        key: '6',
    },
    {
        title: '申报截止时间',
        dataIndex: 'endDate',
        key: '7',
    },
    {
        title: '申报状态',
        dataIndex: 'status',
        key: '8',
    },
    {
        title: '创建时间',
        dataIndex: 'createdAt',
        key: '9',
    },
    {
        title: '申报人',
        dataIndex: 'declarer',
        key: '10',
    },
    {
        title: '操作',
        key: 'action',
        render: (_: any, record: any) => (
            <Space size="middle">
                <Button type="link" onClick={handleDetail(record)}>
                    详情
                </Button>
                <Button type="link" onClick={handleEdit(record)}>
                    修改
                </Button>
                <Popconfirm
                    title="你确定下载吗?"
                    onConfirm={() => handleDelete(record.id)}
                >
                    <Button type="link">申报下载</Button>
                </Popconfirm>
            </Space>
        ),
    },
]
